#include<stdio.h>
#include<string.h>
int strStr(char* a, char* b) {
    int i = 0, j = 0, sz = strlen(b), tmp;
    while (i < strlen(a)) {
        if (a[i] != b[j]) {
            i++;
        } else {
            tmp = i;

            while (j < sz - 1 ) {
                i++;
                j++;
                if (a[i] != b[j]) {
                    i = tmp + 1;//很重要， 因为i重置的位置可能在之前
                    j = 0;
                    break;
                }
            }
            if (j == sz - 1) {
                return tmp;
            }
        }
    }
    return -1;
}
int main(){
    char a[] = "mississippi";
    char b[] = "issip";
    printf("%d", strStr(a, b));
}